home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / CODING / VBASIC / ATT.ZIP / CHIMES.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1994-11-17  |  13.2 KB  |  432 lines

  1. VERSION 2.00
  2. Begin Form Chimes 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   3  'Fixed Double
  5.    Caption         =   "Chimes"
  6.    ClientHeight    =   5835
  7.    ClientLeft      =   3060
  8.    ClientTop       =   1050
  9.    ClientWidth     =   3660
  10.    ClipControls    =   0   'False
  11.    ControlBox      =   0   'False
  12.    Height          =   6270
  13.    Left            =   2985
  14.    LinkTopic       =   "Form2"
  15.    MaxButton       =   0   'False
  16.    MinButton       =   0   'False
  17.    ScaleHeight     =   5835
  18.    ScaleWidth      =   3660
  19.    Top             =   690
  20.    Width           =   3810
  21.    Begin PictureBox PlayIt 
  22.       AutoSize        =   -1  'True
  23.       BorderStyle     =   0  'None
  24.       Height          =   330
  25.       Left            =   510
  26.       Picture         =   CHIMES.FRX:0000
  27.       ScaleHeight     =   330
  28.       ScaleWidth      =   360
  29.       TabIndex        =   12
  30.       Top             =   4530
  31.       Width           =   360
  32.    End
  33.    Begin PictureBox SpeakerDown 
  34.       AutoSize        =   -1  'True
  35.       BorderStyle     =   0  'None
  36.       Height          =   330
  37.       Left            =   5880
  38.       Picture         =   CHIMES.FRX:0182
  39.       ScaleHeight     =   330
  40.       ScaleWidth      =   360
  41.       TabIndex        =   14
  42.       TabStop         =   0   'False
  43.       Top             =   1320
  44.       Width           =   360
  45.    End
  46.    Begin PictureBox SpeakerUp 
  47.       AutoSize        =   -1  'True
  48.       BorderStyle     =   0  'None
  49.       Height          =   330
  50.       Left            =   5880
  51.       Picture         =   CHIMES.FRX:0304
  52.       ScaleHeight     =   330
  53.       ScaleWidth      =   360
  54.       TabIndex        =   15
  55.       TabStop         =   0   'False
  56.       Top             =   840
  57.       Width           =   360
  58.    End
  59.    Begin CommonDialog CMDialog1 
  60.       DefaultExt      =   "wav"
  61.       Filter          =   "Sound files (*.wav)|*.wav"
  62.       Left            =   5880
  63.       Top             =   240
  64.    End
  65.    Begin CommandButton Command1 
  66.       Caption         =   "OK"
  67.       Default         =   -1  'True
  68.       Height          =   330
  69.       Index           =   0
  70.       Left            =   510
  71.       TabIndex        =   10
  72.       Top             =   5250
  73.       Width           =   1170
  74.    End
  75.    Begin CommandButton Command1 
  76.       Cancel          =   -1  'True
  77.       Caption         =   "Cancel"
  78.       Height          =   330
  79.       Index           =   1
  80.       Left            =   1950
  81.       TabIndex        =   11
  82.       Top             =   5250
  83.       Width           =   1170
  84.    End
  85.    Begin SSCheck Chime 
  86.       Caption         =   "Hourly"
  87.       ForeColor       =   &H00000000&
  88.       Height          =   315
  89.       Index           =   0
  90.       Left            =   495
  91.       TabIndex        =   0
  92.       Top             =   330
  93.       Width           =   825
  94.    End
  95.    Begin CommandButton Command2 
  96.       Caption         =   " &Sound..."
  97.       Enabled         =   0   'False
  98.       Height          =   360
  99.       Index           =   0
  100.       Left            =   1950
  101.       TabIndex        =   1
  102.       Top             =   300
  103.       Width           =   1170
  104.    End
  105.    Begin SSCheck Chime 
  106.       Caption         =   "Multi-Ding
  107.       ForeColor       =   &H00000000&
  108.       Height          =   315
  109.       Index           =   4
  110.       Left            =   495
  111.       TabIndex        =   2
  112.       Top             =   1170
  113.       Width           =   1305
  114.    End
  115.    Begin CommandButton Command2 
  116.       Caption         =   " &Sound..."
  117.       Enabled         =   0   'False
  118.       Height          =   360
  119.       Index           =   4
  120.       Left            =   1950
  121.       TabIndex        =   3
  122.       Top             =   1140
  123.       Width           =   1170
  124.    End
  125.    Begin SSCheck Chime 
  126.       Caption         =   "Quarter of"
  127.       ForeColor       =   &H00000000&
  128.       Height          =   315
  129.       Index           =   3
  130.       Left            =   495
  131.       TabIndex        =   8
  132.       Top             =   3690
  133.       Width           =   1230
  134.    End
  135.    Begin CommandButton Command2 
  136.       Caption         =   " &Sound..."
  137.       Enabled         =   0   'False
  138.       Height          =   360
  139.       Index           =   3
  140.       Left            =   1950
  141.       TabIndex        =   9
  142.       Top             =   3660
  143.       Width           =   1170
  144.    End
  145.    Begin SSCheck Chime 
  146.       Caption         =   "Half past"
  147.       ForeColor       =   &H00000000&
  148.       Height          =   315
  149.       Index           =   2
  150.       Left            =   495
  151.       TabIndex        =   6
  152.       Top             =   2850
  153.       Width           =   1215
  154.    End
  155.    Begin CommandButton Command2 
  156.       Caption         =   " &Sound..."
  157.       Enabled         =   0   'False
  158.       Height          =   360
  159.       Index           =   2
  160.       Left            =   1950
  161.       TabIndex        =   7
  162.       Top             =   2820
  163.       Width           =   1170
  164.    End
  165.    Begin SSCheck Chime 
  166.       Caption         =   "Quarter after"
  167.       ForeColor       =   &H00000000&
  168.       Height          =   315
  169.       Index           =   1
  170.       Left            =   495
  171.       TabIndex        =   4
  172.       Top             =   2010
  173.       Width           =   1395
  174.    End
  175.    Begin CommandButton Command2 
  176.       Caption         =   " &Sound..."
  177.       Enabled         =   0   'False
  178.       Height          =   360
  179.       Index           =   1
  180.       Left            =   1950
  181.       TabIndex        =   5
  182.       Top             =   1980
  183.       Width           =   1170
  184.    End
  185.    Begin Label CurrentSound 
  186.       AutoSize        =   -1  'True
  187.       BackStyle       =   0  'Transparent
  188.       Caption         =   "Label1"
  189.       FontBold        =   0   'False
  190.       FontItalic      =   0   'False
  191.       FontName        =   "MS Sans Serif"
  192.       FontSize        =   8.25
  193.       FontStrikethru  =   0   'False
  194.       FontUnderline   =   0   'False
  195.       ForeColor       =   &H00000000&
  196.       Height          =   195
  197.       Left            =   960
  198.       TabIndex        =   20
  199.       Top             =   4590
  200.       Width           =   2535
  201.       WordWrap        =   -1  'True
  202.    End
  203.    Begin Label Label1 
  204.       Alignment       =   1  'Right Justify
  205.       BackStyle       =   0  'Transparent
  206.       Caption         =   "L&&abel1"
  207.       FontBold        =   0   'False
  208.       FontItalic      =   0   'False
  209.       FontName        =   "MS Sans Serif"
  210.       FontSize        =   8.25
  211.       FontStrikethru  =   0   'False
  212.       FontUnderline   =   0   'False
  213.       ForeColor       =   &H00000000&
  214.       Height          =   450
  215.       Index           =   4
  216.       Left            =   75
  217.       TabIndex        =   16
  218.       Top             =   1515
  219.       Width           =   3030
  220.    End
  221.    Begin Label Label1 
  222.       Alignment       =   1  'Right Justify
  223.       BackStyle       =   0  'Transparent
  224.       Caption         =   "Label1"
  225.       FontBold        =   0   'False
  226.       FontItalic      =   0   'False
  227.       FontName        =   "MS Sans Serif"
  228.       FontSize        =   8.25
  229.       FontStrikethru  =   0   'False
  230.       FontUnderline   =   0   'False
  231.       ForeColor       =   &H00000000&
  232.       Height          =   450
  233.       Index           =   3
  234.       Left            =   75
  235.       TabIndex        =   17
  236.       Top             =   4035
  237.       Width           =   3030
  238.    End
  239.    Begin Label Label1 
  240.       Alignment       =   1  'Right Justify
  241.       BackStyle       =   0  'Transparent
  242.       Caption         =   "Label1"
  243.       FontBold        =   0   'False
  244.       FontItalic      =   0   'False
  245.       FontName        =   "MS Sans Serif"
  246.       FontSize        =   8.25
  247.       FontStrikethru  =   0   'False
  248.       FontUnderline   =   0   'False
  249.       ForeColor       =   &H00000000&
  250.       Height          =   450
  251.       Index           =   2
  252.       Left            =   75
  253.       TabIndex        =   18
  254.       Top             =   3195
  255.       Width           =   3030
  256.    End
  257.    Begin Label Label1 
  258.       Alignment       =   1  'Right Justify
  259.       BackStyle       =   0  'Transparent
  260.       Caption         =   "Label1"
  261.       FontBold        =   0   'False
  262.       FontItalic      =   0   'False
  263.       FontName        =   "MS Sans Serif"
  264.       FontSize        =   8.25
  265.       FontStrikethru  =   0   'False
  266.       FontUnderline   =   0   'False
  267.       ForeColor       =   &H00000000&
  268.       Height          =   450
  269.       Index           =   1
  270.       Left            =   75
  271.       TabIndex        =   19
  272.       Top             =   2355
  273.       Width           =   3030
  274.    End
  275.    Begin Label Label1 
  276.       Alignment       =   1  'Right Justify
  277.       BackStyle       =   0  'Transparent
  278.       Caption         =   "Label1"
  279.       FontBold        =   0   'False
  280.       FontItalic      =   0   'False
  281.       FontName        =   "MS Sans Serif"
  282.       FontSize        =   8.25
  283.       FontStrikethru  =   0   'False
  284.       FontUnderline   =   0   'False
  285.       ForeColor       =   &H00000000&
  286.       Height          =   450
  287.       Index           =   0
  288.       Left            =   75
  289.       TabIndex        =   13
  290.       Top             =   675
  291.       Width           =   3030
  292.    End
  293. Option Explicit
  294. Dim Playing As Integer
  295. Sub Chime_Click (Index As Integer, Value As Integer)
  296.    Command2(Index).Enabled = Value
  297.    If Value Then
  298.       Label1(Index).ForeColor = 0
  299.    Else
  300.       Label1(Index).ForeColor = RGB(128, 128, 128)
  301.    End If
  302. End Sub
  303. Sub Chime_GotFocus (Index As Integer)
  304. CurrentSound.Caption = (Label1(Index).Caption)
  305. End Sub
  306. Sub Command1_Click (Index As Integer)
  307. Dim I%
  308. If Index = 0 Then
  309.    For I% = 0 To 3
  310.       Quartering%(I%) = Chime(I%).Value
  311.       Call Chime_Click(I%, (Chime(I%).Value))
  312.       QuarterChimes$(I%) = DitchAmper$(Label1(I%).Caption)
  313.    Next I%
  314.    ChimingRelentlessly = Chime(4).Value
  315.    HourChimes$ = DitchAmper$(Label1(4).Caption)
  316. End If
  317. Unload Me
  318. End Sub
  319. Sub Command2_Click (Index As Integer)
  320.    CMDialog1.CancelError = True
  321.    On Error Resume Next
  322.    Select Case Index
  323.       Case 0
  324.          CMDialog1.DialogTitle = "Choose Hourly Sound File"
  325.          CMDialog1.Filename = QuarterChimes$(Index)
  326.       Case 1
  327.          CMDialog1.DialogTitle = "Choose Quarter-after Sound File"
  328.          CMDialog1.Filename = QuarterChimes$(Index)
  329.       Case 2
  330.          CMDialog1.DialogTitle = "Choose Half-past Sound File"
  331.          CMDialog1.Filename = QuarterChimes$(Index)
  332.       Case 3
  333.          CMDialog1.DialogTitle = "Choose Quarter-of Sound File"
  334.          CMDialog1.Filename = QuarterChimes$(Index)
  335.       Case 4
  336.          CMDialog1.DialogTitle = "Choose Multi-Ding
  337.  Sound File"
  338.          CMDialog1.Filename = HourChimes$
  339.    End Select
  340.    CMDialog1.Flags = OFN_HIDEREADONLY
  341.    CMDialog1.Action = 1
  342.    If Err = 0 Then
  343.       Select Case Index
  344.          Case 0
  345.             QuarterChimes$(Index) = CMDialog1.Filename
  346.          Case 1
  347.             QuarterChimes$(Index) = CMDialog1.Filename
  348.          Case 2
  349.             QuarterChimes$(Index) = CMDialog1.Filename
  350.          Case 3
  351.             QuarterChimes$(Index) = CMDialog1.Filename
  352.          Case 4
  353.             HourChimes$ = CMDialog1.Filename
  354.        End Select
  355.       CurrentSound.Caption = ExpandAmper$(CMDialog1.Filename)
  356.       LoadLabels
  357.       gCMDialog1Filename = CMDialog1.Filename
  358.       Call Chime_Click(Index, True)
  359.    End If
  360. End Sub
  361. Sub Command2_GotFocus (Index As Integer)
  362. CurrentSound.Caption = (Label1(Index).Caption)
  363. End Sub
  364. Sub Command3_Click (Index As Integer)
  365. If Index = 1 Then Unload Me
  366. End Sub
  367. Function DitchAmper$ (ByVal A$)
  368. Dim I%
  369. For I% = 1 To Len(A$) - 1
  370. If Mid$(A$, I%, 2) = "&&" Then
  371.    A$ = Left$(A$, I%) + Mid$(A$, I% + 2, 30000)
  372.    I% = I% - 1
  373. End If
  374. Next I%
  375. DitchAmper$ = A$
  376. End Function
  377. Function ExpandAmper$ (ByVal A$)
  378. Dim I%
  379. For I% = 1 To Len(A$)
  380. If Mid$(A$, I%, 1) = "&" Then
  381.    A$ = Left$(A$, I%) + "&" + Mid$(A$, I% + 1, 30000)
  382.    I% = I% + 1
  383. End If
  384. Next I%
  385. ExpandAmper$ = A$
  386. End Function
  387. Sub Form_Load ()
  388. Dim I%
  389.    Chimes.Left = Screen.Width / 2 - (Chimes.Width / 2)
  390.    Chimes.Top = Screen.Height / 2 - (Chimes.Height / 2)
  391.    For I% = 0 To 3
  392.       Chime(I%).Value = Quartering%(I%)
  393.       Call Chime_Click(I%, (Chime(I%).Value))
  394.    Next I%
  395.    Chime(4).Value = ChimingRelentlessly
  396.    Call Chime_Click(4, (Chime(4).Value))
  397.    LoadLabels
  398. End Sub
  399. Sub Label1_Click (Index As Integer)
  400. CurrentSound.Caption = Label1(Index).Caption
  401. End Sub
  402. Sub LoadLabels ()
  403. Label1(0).Caption = ExpandAmper(QuarterChimes$(0))
  404. Label1(1).Caption = ExpandAmper(QuarterChimes$(1))
  405. Label1(2).Caption = ExpandAmper(QuarterChimes$(2))
  406. Label1(3).Caption = ExpandAmper(QuarterChimes$(3))
  407. Label1(4).Caption = ExpandAmper(HourChimes$)
  408. End Sub
  409. Sub PlayIt_Click ()
  410. Dim x%
  411. If Not ThereIsSOund Then Exit Sub
  412. If SndPlaySound("", 1 + SND_NOSTOP) = 0 Then
  413.    x% = SndPlaySound("", 0)
  414.    Exit Sub
  415. End If
  416. Playing = True
  417.     Do While SndPlaySound(DitchAmper$(CurrentSound.Caption), 1 + SND_NOSTOP) = 0
  418.        If SoundAborted Then
  419.           x% = SndPlaySound("", 0)
  420.           Exit Do
  421.        End If
  422.        'DoEvents
  423.     Loop
  424.     Playing = False
  425. End Sub
  426. Sub PlayIt_MouseDown (Button As Integer, Shift As Integer, x As Single, Y As Single)
  427. PlayIt.Picture = SPeakerDown.Picture
  428. End Sub
  429. Sub PlayIt_MouseUp (Button As Integer, Shift As Integer, x As Single, Y As Single)
  430. PlayIt.Picture = SPeakerUp.Picture
  431. End Sub
  432.